<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsf/composite/componentes"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core">
    <h:form id="formListarMinistracao" styleClass="form-estilo" prependId="false" rendered="#{listarMinistracao.autorizar('PAPEL_LISTAR_MINISTRACAO')}">

        <h:outputText value="#{listarMinistracao.evento.nome}"/>

        <h:commandButton value="Incluir" onclick="painelEditarMinistracao.show()">
            <f:setPropertyActionListener target="#{editarMinistracao.objeto.evento}" value="#{listarMinistracao.evento}"/>
            <f:ajax execute="@this"/>
        </h:commandButton>

        <!--<h:outputLink title="clique aqui para consultar" value="javascript:void(0)" onclick="painelEditarMinistracao.show()">
            <f:setPropertyActionListener target="#{editarMinistracao.objeto.evento}" value="#{listarMinistracao.evento}"/>
            <h:graphicImage value="#{resource['img:incluir2.png']}" style="border: 0px;"/>
        </h:outputLink>-->

        <p:dialog widgetVar="painelEditarMinistracao" header="Editar Ministração" fixedCenter="true" effect="FADE" width="480px" height="200px">
            <ui:include id="pagina" src="/cadastro/editarMinistracao.xhtml"/>
        </p:dialog>

        <c:tabela listarBean="#{listarMinistracao}"
                  navegacao="EDITAR_MINISTRACAO_REDIRECIONAR"
                  objetos="#{listarMinistracao.lista}"
                  ativarIconeEditar="#{listarMinistracao.autorizar('PAPEL_EDITAR_MINISTRACAO')}"
                  ativarIconeRemover="#{listarMinistracao.autorizar('PAPEL_REMOVER_MINISTRACAO')}">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="#{i18n.ministracao_sequencia}"/>
                </f:facet>
                <h:outputText value="#{objeto.sequencia}"/>
            </h:column>
            <h:column>
                <f:facet name="header">
                    <h:outputText value="#{i18n.ministracao_musica}"/>
                </f:facet>
                <h:outputText value="#{objeto.musica.nome}"/>
            </h:column>
        </c:tabela>
    </h:form>
</ui:composition>
